<?php

namespace app\common\service\order\order_status\items;

use think\Exception;

class OrderStatusBase
{

    const WAIT = 1;
    const PROCESSING = 2;//充值中
    const SUCCESS = 3;//成功 已支付 为结算
    const FAIL = 4;//充值失败 （已退款）
    const RERUND_SUCCESS = 4;//（已退款）
    const CANCLE = 10;//已取消

    const INVALID = 11;//无效订单
    const FINISH = 12;//已完成
    const SETTLE = 13;//已结算

    public static $returnMap = [
        1 => '待付款',
        2 => '充值中',
        3 => '充值成功',
        4 => '充值失败',
        5 => '退款中',
        6 => '退款成功',
        10 => '已取消',
        11 => '无效订单',
        12 => '已完成',
        13 => '已结算',
    ];


    /**
     * 获取类型
     */
    public static function getReturnStatus($item, $name = '')
    {
        if (empty(self::$returnMap[$item])) {
            throw new Exception('没有该类型的值');
        }

        return [
            'value' => $item,
            'name' => !empty($name) ? $name : self::$returnMap[$item],
        ];
    }


}